package com.fc.authentication.modules.oauth.service;

import com.fc.authentication.common.exception.RRException;
import com.fc.authentication.common.utils.Constant;
import com.fc.authentication.modules.oauth.dto.AuthRequest;
import com.fc.authentication.modules.oauth.dto.AuthResponse;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by Sunny on 2018/6/21.
 */
@Service
public class AuthService {



    public AuthResponse authentication(AuthRequest authRequest)
    {
        return null;
    }



    private boolean validatePassword(String currentPassword, String password)
    {
        //加密
        currentPassword = DigestUtils.sha256Hex(currentPassword);
        if(currentPassword.equals(password))
        {
            return true;
        }
        throw new RRException("密码不正确，请重新验证", Constant.StatusCode.SC_USER_PASSWORD_INCORRECT);
    }
}
